-- daddy
-- Author: terrason
-- DateCreated: 8/13/2018 9:21:28 PM
--------------------------------------------------------------
include "SupportFunctions.lua"

local function OnCityAddedToMap( playerID: number, cityID : number, cityX : number, cityY : number )
	print("CityAddedToMap - " .. tostring(playerID) .. ":" .. tostring(cityID) .. " " .. tostring(cityX) .. "x" .. tostring(cityY));

	local player = Players[playerID];
	if (not player:IsHuman()) then
		local aPlayers = PlayerManager.GetAliveMajors();
		for loop, p in ipairs(aPlayers) do
			if (p:IsHuman()) then
				UnitManager.InitUnit(p, "UNIT_SETTLER", cityX+4, cityY);
				UnitManager.InitUnit(p, "UNIT_SETTLER", cityX-4, cityY);
			end
		end
	end
end
GameEvents.CityBuilt.Add(OnCityAddedToMap);